import { View, Button } from '@tarojs/components';
import './index.scss';

import IconFont from '../../../components/iconfont';
import Taro from '@tarojs/taro';
import { useEffect, useState } from 'react';

const Chat = () => {

  useEffect(() => {
    init();
  }, []);
  const init = async () => {
    await Taro.getStorage({
      key: 'conversationID',
      success: (res) => {
        if (res.data !== '') {
          Taro.navigateTo({
            url: '../TUIChat/index'
          });
        }
      },
      fail: (res) => {
        console.log('Fail to get conversationID: ', res);
      }
    });
  }

  return <>
    <View className='no-chat'>
      <View className='no-chat-tips no-chat-tips-icon'>
        <IconFont name='chat' size={200} color='#ccc' />
      </View>
      <View className='no-chat-tips no-chat-tips-1'>暂时没有进行中的会话</View>
      <View className='no-chat-tips no-chat-tips-2'>请从首页发起咨询</View>
    </View>
    <Button onClick={() => Taro.navigateTo({ url: '../chatting/index' })}>goto chat</Button>
  </>
}
export default Chat;
